package Models;

import java.util.ArrayList;

import Controller.DBportal;

public class AllIngredients {
	private static ArrayList<Ingredient> malts;
	private static ArrayList<Ingredient> hops;
	private static ArrayList<Ingredient> adjuncts;
	private static ArrayList<Ingredient> yeast;
	
	public AllIngredients(DBportal portal) {
		malts = portal.getIngredient(Ingredient.MALT);
		hops = portal.getIngredient(Ingredient.HOPS);
		adjuncts = portal.getIngredient(Ingredient.ADJUNCT);
		yeast = portal.getIngredient(Ingredient.YEAST);
	}
	
	public static void remove(Ingredient old) {
		switch(old.getIngredientType()) {
		case Ingredient.MALT: malts.remove(old); break;
		case Ingredient.HOPS: malts.remove(old);break;
		case Ingredient.ADJUNCT: malts.remove(old);break;
		case Ingredient.YEAST: malts.remove(old); break;
		}
	}
	
	public static void addIngredient(Ingredient newIng) {
		switch(newIng.getIngredientType()) {
		case Ingredient.MALT: malts.add(newIng); break;
		case Ingredient.HOPS: malts.add(newIng);break;
		case Ingredient.ADJUNCT: malts.add(newIng);break;
		case Ingredient.YEAST: malts.add(newIng); break;
		}
	}

	/**
	 * @return the malts
	 */
	public static ArrayList<Ingredient> getMalts() {
		return malts;
	}

	/**
	 * @return the hops
	 */
	public static ArrayList<Ingredient> getHops() {
		return hops;
	}

	/**
	 * @return the adjuncts
	 */
	public static ArrayList<Ingredient> getAdjuncts() {
		return adjuncts;
	}

	/**
	 * @return the yeast
	 */
	public static ArrayList<Ingredient> getYeast() {
		return yeast;
	}
}
